package com.hongxin.nw.netty.model.packing;

import com.hongxin.nw.netty.utils.BinaryTools;
import com.hongxin.nw.netty.utils.FieldPack;
import com.hongxin.nw.netty.values.StaticValue;
import com.hongxin.nw.netty.values.TypeIdentif;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * @remark --
 * @author: GuoXiaolin
 * @date 2019/5/22 19:03
 * @Version 1.0
 * @Descibe
 */
@Slf4j
@Getter
@Setter
public class ASDUccina1{

    private String qcc;

    public void setQcc(Integer rqt,Integer frz) {
        String sfrz = BinaryTools.addZero(Integer.toBinaryString(frz),2,StaticValue.DIRECTION_LEFT);
        String srqt = BinaryTools.addZero(Integer.toBinaryString(rqt),6,StaticValue.DIRECTION_LEFT);
        String record = String.valueOf(Integer.valueOf(srqt + sfrz,2));
        this.qcc = FieldPack.caseToBin(record, TypeIdentif.BYTE_QCC.getByteLength());
    }

    public String getHexData(){
        return this.qcc;
    }

    @Override
    public String toString() {
        return "ASDUccina1{" +
                "qcc='" + qcc + '\'' +
                '}';
    }
}
